<?php

/**
 * @author игорь
 * @copyright 2009
 */
$action_template = "index";
if(!empty($cats))
{
	$cat_lim = 4;
	$i = 0;
	foreach($cats as $k=>$v)
	{
		$games = $db->fetch_array("SELECT SQL_CALC_FOUND_ROWS * FROM $table_games WHERE category_id = '".$v['id']."' AND status = '2' ORDER BY RAND() LIMIT $cat_lim");
		if(!empty($games))
		{
			foreach($games as $n=>$g)
			{
				if($g['image'] == '1')
				{
					$games[$n]['image'] = UPLOAD."flash/".$g['id'];
				}
				else $games[$n]['image'] = false;
			}
			$items[$i] = $v;
			$items[$i]['games'] = $games;
			$i++;
		}
	}
	$smarty->assign("items",$items);
}
$header = $this->info['title'];
$smarty->assign("header",$header);
?>